//
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
using namespace std;

char codes[11][11];
char Long[11],Short[11],Des[11];

void f(int n,int count)
{
    bool flag = true;
    for(int i=0;i<n-1;i++)
    {
        if(!flag) break;
        for(int j=i+1;j<n;j++)
        {
            memset(Long,0,sizeof(Long));
            memset(Short,0,sizeof(Short));
            memset(Des,0,sizeof(Des));
            if( strlen(codes[i])>strlen(codes[j]) )
            {
                strcpy(Long,codes[i]);
                strcpy(Short,codes[j]);
            }
            else if ( strlen(codes[i])<strlen(codes[j]) )
            {
                strcpy(Long,codes[j]);
                strcpy(Short,codes[i]);
            }
            else
            {
                if( strcmp(codes[i],codes[j])==0 )  { flag=false; break;  }
                else continue;
            }
            strncpy(Des,Long,strlen(Short));
            //cout<<"Long : "<<Long<<" Short : "<<Short<<" codes[i] : "<<codes[i]<<" codes[j] : "<<codes[j]<<" Des : "<<Des<<endl;
            if( strlen(Long)>0&&strlen(Short)&&strcmp(Short,Des)==0 )  { flag=false; break;  }
		}
	}
    if(flag) cout<<"Set "<<count<<" is immediately decodable"<<endl;
    else cout<<"Set "<<count<<" is not immediately decodable"<<endl;
} 

int main()
{
    int i=0,count=1;
    while(scanf("%s",codes[i])!=EOF)
    {
        if( strcmp(codes[i],"9")==0 ) { f(i,count++);i=0;continue;}
        i++;
    }
    return 0;
}                                                                                                                                           
